<?php
namespace Common\Model;
use Common\Common\Model;
class companyModel extends Model {
    protected $tableName = 'company';

    protected $tablePrimary = ['id'];

    protected $odjectClass='Common\Model\companyObject';

    public function fetchByUsername($key){
        $result = $this->where(['username'=>$key])->find();
        if($result == null) return null;
        return $this->make($result);
    }
    /**
     * 用户登录标记
     * @param CustomerObject $user
     */
    public function login(CustomerObject $user){
        $_SESSION['id'] = $user->id;
        $_SESSION['username'] = $user->username;
    }

    public function test(){
        $user2=$_SESSION['id'];
        return  $user2;
    }
    /**
     * 用户投递标记
     * @param CustomerObject $user
     */

    public function test1(){
        $user2=$_SESSION['username'];
        return  $user2;
    }
    

}